package cn.com.jcoo.example.starter;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;

@Slf4j
@AutoConfiguration
@EnableConfigurationProperties(SimpleProperties.class)
public class SimpleAutoConfig {

    @Bean
    @ConditionalOnMissingBean
    public SimpleService simpleService(SimpleProperties simpleProperties) {
        log.info("加载SimpleService...");
        return new SimpleService(simpleProperties);
    }
}
